#include "./PantsuEngine/PantsuEngine.h"

#include <iostream>

using namespace Pantsu;

float rand_FloatRange(float a, float b)
{
	return ((b-a)*((float)rand()/RAND_MAX))+a;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {

	PantsuEngine::Get()->InitEngine( hInstance );

	SceneManager *sm = PantsuEngine::Get()->CreateSceneManager("SceneManager");
	
	for ( int i = 0; i < 100; ++ i ) {

		GameObject *go = sm->CreateGameObject("dieo");
		go->AttachComponent("RenderPoint");
		go->AttachComponent("Particle");

		Vector3 vel( rand_FloatRange( 0.1f, 20.1000f) , rand_FloatRange( 2.3000f, 10.5000f), rand_FloatRange( 0.000f, 0.000f) );

		static_cast<ParticleComponent*>(go->GetComponent("Particle"))->SetMass( rand_FloatRange( 0.1f, 10.1000f) );
		static_cast<ParticleComponent*>(go->GetComponent("Particle"))->SetVelocity(vel);
	}


	while ( true ) 
		PantsuEngine::Get()->RenderOneFrame();
	

	PantsuEngine::Get()->DeInitEngine();
	printf("\n Pantsu Engine..! \n");
	system("PAUSE");
}